1 00:00:00,420 --> 00:00:07,770 ‫Welcome to lecture three, and this is where we are going to start writing a piece I saw into this lecture, 2 00:00:08,100 --> 00:00:12,050 ‫we are going to be creating our first EPA as promised in the previous one. 3 00:00:12,300 --> 00:00:20,240 ‫So when we left here last time, we had created this EPA dopa fire inside of the air, P.M., you know, 4 00:00:20,310 --> 00:00:27,210 ‫beneath the master module instead of Europea next mustardy up that we created and installed on top of 5 00:00:27,210 --> 00:00:27,810 ‫our site. 6 00:00:27,990 --> 00:00:32,700 ‫So I'm hopeful that you have this configured into additive to create to a first EPA. 7 00:00:33,000 --> 00:00:35,420 ‫So how do we create a space in Europe next? 8 00:00:35,430 --> 00:00:38,730 ‫Remember this important frumpies very, very important piece. 9 00:00:38,730 --> 00:00:39,390 ‫Very important. 10 00:00:39,390 --> 00:00:44,240 ‫So don't overlook it makes you not on your inside of your file. 11 00:00:44,580 --> 00:00:47,010 ‫And then remember, this is Painton. 12 00:00:47,220 --> 00:00:50,910 ‫So for you to write your API, what you want to do is just to define a function. 13 00:00:51,210 --> 00:00:58,980 ‫And I will be working with the with the items items doctype like like I promised when you are starting 14 00:00:59,220 --> 00:01:03,140 ‫or you can also find that in the in the, in the, in the curriculum of this course. 15 00:01:03,420 --> 00:01:07,500 ‫So let me head over to items item. 16 00:01:07,500 --> 00:01:10,830 ‫It's the item list and I don't have any items. 17 00:01:10,830 --> 00:01:12,290 ‫You are going to be creating items here. 18 00:01:12,480 --> 00:01:18,480 ‫We are going to be at the end of this course creating items and removing and editing and doing all that, 19 00:01:18,480 --> 00:01:20,660 ‫the current operations using our API. 20 00:01:20,670 --> 00:01:27,450 ‫So if you want to write, for instance, an API that is going to fetch all the items for now this month, 21 00:01:27,450 --> 00:01:29,460 ‫I want to demo with this one. 22 00:01:29,760 --> 00:01:30,960 ‫I can just call this. 23 00:01:31,170 --> 00:01:36,780 ‫Get all items, get all items. 24 00:01:36,790 --> 00:01:39,450 ‫Remember, this is a function so defined. 25 00:01:39,450 --> 00:01:40,440 ‫Get our items. 26 00:01:40,440 --> 00:01:43,920 ‫And then here I want to write an ASCII wealth statement. 27 00:01:43,920 --> 00:01:50,090 ‫So let me tell you guys, do not be limited to what you can do with this theme. 28 00:01:50,100 --> 00:01:54,810 ‫This is just Python, the python that, you know, it is the square that you know. 29 00:01:54,960 --> 00:01:56,790 ‫So do whatever you want to do here. 30 00:01:56,820 --> 00:01:57,690 ‫This is your API. 31 00:01:57,690 --> 00:01:59,070 ‫You can do whatever you want to do with it. 32 00:01:59,400 --> 00:02:05,220 ‫So I want to show you a method that I use so much, the kind of queries that I write and I am able to 33 00:02:05,220 --> 00:02:09,690 ‫achieve almost everything that I want to do within Europeanised ecosystem. 34 00:02:09,690 --> 00:02:11,760 ‫So let me say, this is items. 35 00:02:12,180 --> 00:02:14,490 ‫This is a variable that's going to save my items. 36 00:02:14,850 --> 00:02:16,920 ‫And I am going to send this to Frappier. 37 00:02:18,210 --> 00:02:23,540 ‫But make sure you are getting this well, the don't dot and then I give Heskey well. 38 00:02:23,910 --> 00:02:24,390 ‫All right. 39 00:02:24,780 --> 00:02:36,420 ‫So we have Rapido the of this year and then here Mitu give six quotation marks and then inside of here 40 00:02:36,750 --> 00:02:42,090 ‫I am now going to write my statement like select this is Escutia that you know and I'm going to select 41 00:02:42,210 --> 00:02:42,800 ‫all. 42 00:02:42,840 --> 00:02:44,760 ‫We will be limiting this in the future. 43 00:02:45,060 --> 00:02:48,680 ‫And then from and the tables are named instead of Europea. 44 00:02:48,690 --> 00:02:55,950 ‫Next let me go to my dot p p p p my admin. 45 00:02:55,950 --> 00:02:59,790 ‫Here's what you can see this and I can see I have three database tables here. 46 00:02:59,790 --> 00:03:00,780 ‫I do not know which one. 47 00:03:00,780 --> 00:03:02,070 ‫I am using it on this side. 48 00:03:02,280 --> 00:03:03,720 ‫So how are you going to check this? 49 00:03:03,720 --> 00:03:08,880 ‫Just head back to your board, look for your side and my side is currently in. 50 00:03:08,880 --> 00:03:10,570 ‫Go to your side config file. 51 00:03:10,590 --> 00:03:17,500 ‫Remember in the previous lecture I explained to you that some things we had to do this file, so open 52 00:03:17,520 --> 00:03:21,030 ‫it in DBI name is this one. 53 00:03:21,030 --> 00:03:25,140 ‫So you're able to see which database, which database you are using on your project. 54 00:03:25,140 --> 00:03:28,680 ‫So it starts with fifty nine and ends with KDDI. 55 00:03:28,680 --> 00:03:31,350 ‫So now I can go back here and clearly it is this one. 56 00:03:31,350 --> 00:03:35,400 ‫So I open it and just look at the European names. 57 00:03:35,400 --> 00:03:39,420 ‫It's tables, it starts with Déby so tab and then the name of the table. 58 00:03:39,630 --> 00:03:44,760 ‫And if you need to get this table for instance, this one is not employee and then space Budinger, 59 00:03:44,760 --> 00:03:45,900 ‫then space activity. 60 00:03:46,200 --> 00:03:51,900 ‫When you're arguing with these types of tables on the inside of your API, what you need to do is to 61 00:03:51,900 --> 00:03:58,410 ‫put batiks, batiks, and then of course, now you can go ahead and provide the name of your table. 62 00:03:58,410 --> 00:03:59,460 ‫You're not interested in that. 63 00:03:59,460 --> 00:04:06,350 ‫Remember, we're interested in the items table, so I can just start taping item and disadvantage. 64 00:04:06,360 --> 00:04:09,900 ‫So let me just go back in to item. 65 00:04:10,140 --> 00:04:15,450 ‫And here is my top item, of course, the attack by the mobile division, all these items. 66 00:04:15,840 --> 00:04:18,120 ‫But we are interested in this one item. 67 00:04:18,600 --> 00:04:19,260 ‫I open it. 68 00:04:19,440 --> 00:04:27,270 ‫And by the way, let me mention how I am able to see, to use your opinion with my admin is that I have 69 00:04:27,270 --> 00:04:35,140 ‫installed our party on both ADT and then I am running my admin on top of that bot and therefore you 70 00:04:35,140 --> 00:04:36,750 ‫are able to access the databases. 71 00:04:36,990 --> 00:04:40,260 ‫Remember, your next use is Maria Déby is head of that board. 72 00:04:40,440 --> 00:04:42,180 ‫So what do you want to do here? 73 00:04:42,570 --> 00:04:50,190 ‫Check that and then we can see here we do not have any items for now, just like we can see from here. 74 00:04:50,490 --> 00:04:55,290 ‫And therefore, let's go back to Amarcord and remember to to get the name of this one. 75 00:04:55,290 --> 00:04:59,910 ‫So this is that item, this one, because it's just one one we don't need to put it inside of. 76 00:05:00,350 --> 00:05:03,840 ‫But even if you do this one and then what are you going to do here? 77 00:05:04,720 --> 00:05:09,300 ‫There's something like preened and then I'm going to do Poochigian Marks. 78 00:05:09,780 --> 00:05:15,600 ‫And just for the sake of seeing where I have printed, I'm going to do that. 79 00:05:16,430 --> 00:05:21,570 ‫Then I'm going to do four, five, six, so that the item that going to be printed here is going to 80 00:05:21,570 --> 00:05:22,880 ‫have spaces around it. 81 00:05:23,100 --> 00:05:30,300 ‫And since I am, I am putting this one inside of this discarded brackets, the I need to provide for 82 00:05:30,300 --> 00:05:37,320 ‫my dad sitting here and now because this one is done, I can go to my postman here, look at you, Tamino, 83 00:05:37,680 --> 00:05:46,880 ‫and think I need to stop this so that we create a little and then run away and start again, create 84 00:05:46,890 --> 00:05:47,400 ‫some room. 85 00:05:47,400 --> 00:05:49,290 ‫Here it is watching. 86 00:05:49,290 --> 00:05:53,040 ‫Let's wait for it to finish watching, to finish our loading. 87 00:05:53,040 --> 00:05:57,930 ‫And we can confirm by loading here when it is ready. 88 00:05:58,890 --> 00:05:59,310 ‫All right. 89 00:06:00,030 --> 00:06:06,300 ‫So as this one prepares to do its thing, get you get you get to a postman ready and I want you to supply 90 00:06:06,300 --> 00:06:08,880 ‫instead of your postman, open a new tab here. 91 00:06:09,360 --> 00:06:15,870 ‫You know, what I want you to give here is remember, you are running this thing on put on 40000. 92 00:06:15,870 --> 00:06:19,590 ‫And so you are going to put your board here so many thousand and three. 93 00:06:19,920 --> 00:06:21,600 ‫So I'm going to be posting this here. 94 00:06:21,600 --> 00:06:22,650 ‫So I have that. 95 00:06:22,950 --> 00:06:25,560 ‫And then the next thing I'm going to supply is API. 96 00:06:25,650 --> 00:06:32,670 ‫Remember, we are running on eBay and of course the next thing is method and the method is the next 97 00:06:32,670 --> 00:06:33,210 ‫mustardy. 98 00:06:34,540 --> 00:06:40,820 ‫And let me go back to the calls that you understand all this is so what we are doing here, API, you 99 00:06:40,830 --> 00:06:47,790 ‫supply API, you supply API because you want to interact with the ERP next API and then the next thing 100 00:06:47,790 --> 00:06:48,500 ‫is the method. 101 00:06:48,510 --> 00:06:53,650 ‫So the method, you just type method and then you want to ERP next, which may not want to get in. 102 00:06:53,670 --> 00:06:55,760 ‫Remember here to do that, this one is a method. 103 00:06:55,810 --> 00:06:58,860 ‫Remember this one is an app and this one is a method. 104 00:06:59,070 --> 00:07:04,290 ‫And then from here from the ERP next mustardy the next thing is their final data on to access. 105 00:07:04,300 --> 00:07:10,550 ‫So instead of your side of our ERP next mustardy, we have a file called Epitope. 106 00:07:10,980 --> 00:07:16,080 ‫So this what you want to access as the next thing and which is this file here and then the next thing, 107 00:07:16,080 --> 00:07:20,470 ‫which is API, which is which is this one is the method that you want to access. 108 00:07:20,470 --> 00:07:24,340 ‫So in this case it will be get all items and this is what they need to apply here. 109 00:07:24,400 --> 00:07:24,820 ‫Right. 110 00:07:25,050 --> 00:07:31,080 ‫So if you can't use, however, something else, make sure to supply this one inside of here so that 111 00:07:31,080 --> 00:07:36,570 ‫when you consent to this request, it is going to call this do whatever you have to to do here and then 112 00:07:36,580 --> 00:07:38,130 ‫print this thing on the Tamino. 113 00:07:38,820 --> 00:07:41,190 ‫And before you close here, you need to do that. 114 00:07:42,450 --> 00:07:45,660 ‫And then when we know, go ahead and send this one. 115 00:07:45,660 --> 00:07:48,450 ‫We are going to get our to get our response. 116 00:07:48,450 --> 00:07:53,190 ‫And by the way, even before we send it on postman, if you want to do it or their browser can just 117 00:07:53,190 --> 00:07:55,470 ‫based it on the browser, click on next. 118 00:07:55,710 --> 00:07:56,670 ‫And you can see this. 119 00:07:56,820 --> 00:08:01,490 ‫This is these are not permitted exceptions here. 120 00:08:01,830 --> 00:08:07,740 ‫So what this means is that you do not have permissions to do this because that EPA is protected. 121 00:08:08,100 --> 00:08:13,800 ‫We are going to be exploring more about the protection of APIs and how you can expose them later in 122 00:08:13,800 --> 00:08:14,340 ‫this course. 123 00:08:14,640 --> 00:08:18,140 ‫But in this one, I just want to show you how you can make that one open. 124 00:08:18,150 --> 00:08:19,800 ‫So would you want to do here? 125 00:08:20,650 --> 00:08:27,030 ‫We are going to be seeing frappé don't wait list for a bit of a wait list. 126 00:08:27,570 --> 00:08:29,580 ‫And then what do you want to do now? 127 00:08:29,580 --> 00:08:31,230 ‫Try again to send the same request. 128 00:08:31,850 --> 00:08:37,620 ‫Are you again here you are getting empty, right? 129 00:08:38,130 --> 00:08:42,870 ‫You are getting an empty array and there is an empty object and they just only you're getting an empty 130 00:08:42,870 --> 00:08:46,320 ‫object is clearly because you are table here is empty. 131 00:08:46,340 --> 00:08:46,770 ‫Right. 132 00:08:47,100 --> 00:08:48,600 ‫Your table here is empty. 133 00:08:48,930 --> 00:08:51,350 ‫The items table does not have items yet. 134 00:08:51,360 --> 00:08:57,210 ‫So apparently this one is working and we are we are going to be trying to send this thing inside of 135 00:08:57,210 --> 00:08:57,900 ‫Europeanised. 136 00:08:58,170 --> 00:09:01,410 ‫So send it in here. 137 00:09:01,410 --> 00:09:02,610 ‫You're going to get an exception. 138 00:09:02,610 --> 00:09:04,080 ‫This thing clearly doesn't work. 139 00:09:04,230 --> 00:09:08,780 ‫So you go to preview and you can see that you do not have enough permissions to complete this action. 140 00:09:09,090 --> 00:09:13,980 ‫What we are seeing here is closely related to what we are seeing on the browser when we sent it. 141 00:09:14,250 --> 00:09:17,690 ‫But on the browser, it is watching what is happening to our postman. 142 00:09:17,970 --> 00:09:23,820 ‫And remember, most of the applications that you are going to be using to consume this API will be outside 143 00:09:23,820 --> 00:09:24,710 ‫of ERP next. 144 00:09:24,990 --> 00:09:29,100 ‫Salt Lake, for instance, you are mobile app, maybe a mobile app that you have been working on. 145 00:09:29,310 --> 00:09:29,970 ‫Maybe it is. 146 00:09:30,210 --> 00:09:30,630 ‫It is. 147 00:09:30,630 --> 00:09:33,420 ‫And it is an application developed using angular. 148 00:09:33,720 --> 00:09:38,910 ‫Maybe it is an application developed using any other framework like, like react or whatever you are 149 00:09:38,910 --> 00:09:39,300 ‫using. 150 00:09:39,570 --> 00:09:42,840 ‫This is going to require you to know how to do this. 151 00:09:43,020 --> 00:09:46,490 ‫So I'm going to be delving into that later in the course. 152 00:09:46,770 --> 00:09:48,980 ‫So far for the purpose of this one. 153 00:09:48,990 --> 00:09:54,180 ‫Remember, it was just an introduction to APIs and this is already APIs and the waitlist function, 154 00:09:54,180 --> 00:09:59,760 ‫which makes sure that this function is opened and it can be accessed for. 155 00:10:00,610 --> 00:10:06,370 ‫And that is it sort when you go to the terminal here again, because we have we have requested that 156 00:10:06,640 --> 00:10:10,230 ‫you're going to be seeing there is some space somewhere and here you go. 157 00:10:10,600 --> 00:10:11,250 ‫There is space. 158 00:10:11,280 --> 00:10:14,830 ‫That is where we put these these bricks. 159 00:10:14,840 --> 00:10:21,320 ‫So we have the bricks before they are the object itself and three bricks after the object. 160 00:10:21,340 --> 00:10:26,330 ‫So what this does is that it creates this space here before and after, and this is our object. 161 00:10:26,680 --> 00:10:31,350 ‫So, again, the object here is empty because we do not have items in our table. 162 00:10:31,510 --> 00:10:37,780 ‫So as we carry on, we are going to be learning how to to to put items inside of this table from the 163 00:10:37,780 --> 00:10:38,320 ‫API. 164 00:10:38,470 --> 00:10:42,320 ‫You're going to learn how to delete them, update them and everything. 165 00:10:42,340 --> 00:10:43,890 ‫Everything cannot function that you know. 166 00:10:44,200 --> 00:10:47,680 ‫So I will stop here for this one, next one in the next. 167 00:10:47,710 --> 00:10:51,520 ‫Next year we are going to carry on with our API and see what we can do with it. 168 00:10:51,940 --> 00:10:52,360 ‫Thank you. 169 00:10:52,360 --> 00:10:54,390 ‫And see you in the next next year.